import 'dart:async';

import 'package:event_bus/event_bus.dart';

class EventManager {
  /// 单例
  EventManager._internal();
  static final EventManager shared = EventManager._internal();
  factory EventManager() => shared;

  final EventBus _eventBus = EventBus();

  StreamController get streamController => _eventBus.streamController;

  void fire(dynamic event) {
    _eventBus.fire(event);
  }

  Stream<T> on<T>() {
    return _eventBus.on<T>();
  }

  void destroy() {
    _eventBus.destroy();
  }
}